<?php
	include("inc.aplication_top.php");

	$action                 = mysql_real_escape_string($_POST['action']);
	$opcion                 = mysql_real_escape_string($_POST['opcion']);
	$updateRecordsArray     = $_POST['recordsArray'];

	if ($action == "actualizar_posicion" && $opcion == "portada"){
	
		$objPortada = new Portada;

		$listingCounter = 1;
		foreach ($updateRecordsArray as $recordIDValue) {
			$objPortada->reordenar($recordIDValue, $listingCounter);
			$listingCounter = $listingCounter + 1; 
		}

	}
	
	if ($action == "actualizar_posicion" && $opcion == "catalogo"){
	
		$objCatalogo = new Catalogo;

		$listingCounter = 1;
		foreach ($updateRecordsArray as $recordIDValue) {
			$objCatalogo->reordenar($recordIDValue, $listingCounter);
			$listingCounter = $listingCounter + 1; 
		}

	}
	
	if ($action == "actualizar_posicion" && $opcion == "coleccion"){
	
		$objColeccion = new Coleccion;

		$listingCounter = 1;
		foreach ($updateRecordsArray as $recordIDValue) {
			$objColeccion->reordenar($recordIDValue, $listingCounter);
			$listingCounter = $listingCounter + 1; 
		}

	}
	
?>